Empty interfaces are either useless or used as a marker. Custom attributes are a better alternative to marker
interfaces. See the How to fix it section for more information.
Exceptions
This rule doesn’t raise in any of the following cases:
Aggregation of multiple interfaces
public interface IAggregate: IComparable, IFormattable { } // Compliant: Aggregates two interfaces
Generic specialization
An empty interface with a single base interface is compliant as long as the resulting interface binds a generic parameter or constrains it.
// Compliant: Bound to a concrete type
public interface IStringEquatable: IEquatable<string> { }
// Compliant: Specialized by type parameter constraint
public interface ICreateableEquatable<T>: IEquatable<T> where T: new() { }
Custom attribute
An empty interface is compliant if a custom attribute is applied to the interface.
[Obsolete]
public interface ISorted { } // Compliant: An attribute is applied to the interface declaration